<?php
/**
 * Created by PhpStorm.
 * User: zhan
 * Date: 2017/11/9  19:27
 */
namespace app\pc\logic;
use app\pc\BaseModel;

class Ioan extends  BaseModel{

	//检测参数是否已传
    protected $ParameterDetection  = [
    	'entry'=>['name','mobile','city','gender','age','loan_amount','credit_card','property','car_production','career','pay_method','income','provident_fund','social_security','loan_term','code']
    ];

	/**
	* 录入
	*/
	public function entry(){
		$code = $this->requestData['code'];

		$data['name'] = $this->requestData['name'];
		$data['mobile'] = $this->requestData['mobile'];
		$data['city'] = $this->requestData['city'];
		$data['gender'] = $this->requestData['gender'];
		$data['age'] = $this->requestData['age'];
		$data['loan_amount'] = $this->requestData['loan_amount'];
		$data['credit_card'] = $this->requestData['credit_card'];
		$data['property'] = $this->requestData['property'];
		$data['car_production'] = $this->requestData['car_production'];
		$data['career'] = $this->requestData['career'];
		$data['pay_method'] = $this->requestData['pay_method'];
		$data['income'] = $this->requestData['income'];
		$data['provident_fund'] = $this->requestData['provident_fund'];
		$data['social_security'] = $this->requestData['social_security'];
		$data['loan_term'] = $this->requestData['loan_term'];
		$data['mid'] = $this->user['id'];

		$codo_bool = (new \app\pc\logic\Login())->check_verify($code);
		if(!$codo_bool)return ['message'=>'验证码有误!'];
		$res = db('loan_info')->insert($data);
		if(!$res)return ['message'=>'申请失败!'];
	}
}